#pragma once
namespace snow {
	template <typename T>
	class Filter
	{
	public:
		Filter(int _width, int _height)
			:m_nWidth(_width),
			m_nHeight(_height) {
			ptrData = new T[m_nWidth * m_nHeight];
		}

		~Filter() {
			delete[] ptrData;
		}
	private:
		int m_nWidth;
		int m_nHeight;

		T* ptrData;

	public:
		T& get(int row, int col) {
			return *(ptrData + row * m_nWidth + col);
		}

		void fill(T* ptr) {
			int index = 0;
			for (int row = 0; row < m_nHeight; row++) {
				for (int column = 0; column < m_nWidth; column++) {
					this->set(row, column, *(ptr + index));
				}
			}
		}

		void set(int row, int col, T value) {
			*(ptrData + row * m_nWidth + col) = value;
		}

		int getWidth() { return m_nWidth; }
		int getHeight() { return m_nHeight; }
		T* getFilterVector() {
			return ptrData;
		}
	};
}
